<?php
namespace app\api\controller;
use app\admin\model\Member as MemberModel;
use think\Db;
use think\Session;
use think\Cookie;
class Member  {
	
	//注册
	public function test(){
		$post['account']=input('mobile');
		$post['password']=md5(input('pwd'));
		$post['create_time']= date('y-m-d',time());
			//	$post['verifycode']=input('verifycode');
		if(Db::name('member')->where('account',$post['account'])->find()){
			return jsonp(['code' => 406,'msg'=>'该手机号已注册']);
		}else{
		Db::name('member')->insert($post);
		return jsonp(['code' => 200, 'data'=>'ok']);
		}
	}

//登录
		public function login(){
	$post['account']=input('mobile');
	$post['password']=md5(input('pwd'));
	$member=Db::name('member')->where($post)->find();
	if($member){
		return jsonp(['code' => 200, 'data'=>'登录成功','member'=>$member]);
	}else{
		return jsonp(['code' => 406, 'data'=>'账户或者密码错误']);
	}
	
			}

}
